package avicit.rme.back.workflow.event;
// 全局和人工节点的前置事件、后置事件、超时事件，流转线上的流转事件

/**
import avicit.platform6.api.bpm.event.EventCallBackType;
import avicit.platform6.api.bpm.event.EventParam;
import avicit.platform6.api.bpm.event.param.*;
import avicit.platform6.api.bpm.eventInterface.CommonRestEventInterface;
import avicit.platform6.core.rest.msg.ResponseMsg;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/demo/bpm/TestRestEventListener")
public class TestRestEventListener implements CommonRestEventInterface {

    @Override
    @PostMapping("/notify/v1")
    public ResponseMsg<List<EventParam>> notify(@RequestBody() Map<String, String> arg) throws Exception {
        ResponseMsg<List<EventParam>> responseMsg = new ResponseMsg();

        // 默认流程变量开始
        // 流程实例ID
        String processInstanceId = arg.get("processInstanceId");
        // 流程执行ID
        String executionId = arg.get("executionId");
        // 业务表单ID
        String formId = arg.get("formId");
        // 流程定义ID
        String processDefId = arg.get("processDefId");
        // 流程节点标识
        String activityName = arg.get("activityName");
        // 默认流程变量结束

        List<EventParam> eventParamList = new ArrayList<EventParam>();

        // 设置流程变量接口
        Map<String,Object> variables = new HashMap<>();
        variables.put("test_var","1");
        SetVariablesParam setVariablesParam = new SetVariablesParam();
        setVariablesParam.setExecutionId(arg.get("executionId"));
        setVariablesParam.setVariables(variables);
        EventParam<SetVariablesParam> eventParamSetVariables = new EventParam<>(EventCallBackType.OPERTYPE_SETVARIABLES, setVariablesParam);
        eventParamList.add(eventParamSetVariables);

        // 根据流程实例id修改任务标题
        ChangeTaskTitleByProcInstIdParam changeTaskTitleByProcInstIdParam = new ChangeTaskTitleByProcInstIdParam();
        EventParam<ChangeTaskTitleByProcInstIdParam> changeTaskTitle = new EventParam<>(EventCallBackType.OPERTYPE_CHANGETASKTITLEBYPROCiNSTID, changeTaskTitleByProcInstIdParam);
        eventParamList.add(changeTaskTitle);

        // 根据formId修改任务标题
        ChangeTaskTitleByFormIdParam changeTaskTitleByFormIdParam = new ChangeTaskTitleByFormIdParam();
        EventParam<ChangeTaskTitleByFormIdParam> changeTaskTitleByFormId = new EventParam<>(EventCallBackType.OPERTYPE_CHANGETASKTITLEBYFORMID, changeTaskTitleByFormIdParam);
        eventParamList.add(changeTaskTitleByFormId);

        // 状态节点流程提交
        SignalStateParam signalStateParam = new SignalStateParam();
        signalStateParam.setExecutionId(executionId);
        signalStateParam.setSignalName("test");
        signalStateParam.setParameters(new HashMap<>());
        EventParam<SignalStateParam> signalStateParamEvent = new EventParam<>(EventCallBackType.OPERTYPE_SIGNALSTATE, signalStateParam);
        eventParamList.add(signalStateParamEvent);

        // 保存节点自定义审批人
        SaveUserDefinedParam saveUserDefinedParam = new SaveUserDefinedParam();
        saveUserDefinedParam.setActivityName("tast1");
        saveUserDefinedParam.setProcessInstanceId(processInstanceId);
        saveUserDefinedParam.setSelectUserIds("1,2,3");
        EventParam<SaveUserDefinedParam> saveUserDefinedParamEventParam = new EventParam<>(EventCallBackType.OPERTYPE_SAVEUSERDEFINED, saveUserDefinedParam);
        eventParamList.add(saveUserDefinedParamEventParam);

        responseMsg.setResponseBody(eventParamList);
        return responseMsg;
    }
}
*/